package com.hyzh.latte.sandtable.controller;

import com.hyzh.latte.sandtable.pojo.QueryRequest.Vector.RoadUpdate;
import com.hyzh.latte.sandtable.pojo.Result;
import com.hyzh.latte.sandtable.service.VectorService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/vector")
@AllArgsConstructor
public class VectorController {
   private final VectorService vectorService;
    @PostMapping("/road/update")
    public Result updateRoad(@RequestBody RoadUpdate queryRequest){
        try {
            vectorService.updateRoad(queryRequest.getLines(),queryRequest.getArea());
            return Result.success();
        }catch (Exception e){
            e.printStackTrace();
            return Result.error("添加失败");
        }
    }
}
